<?php
session_start();
header("content-type:text/html;charset=utf-8");
$lifetime=24*60*60;
$time=time();
if(isset($_SESSION['ad_activetime'])){
	if(intval($_SESSION['ad_activetime'])<$time-$lifetime){
	echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n<script>
	alert('登录超时，请重新登录！');\n
	top.location.href='../index.php';\n
	</script>";
	}else{
	$_SESSION['ad_activetime']=$time;
}
}
if (!isset($_SESSION["ad_id"])){
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n<script>
alert('您没有登录或不是管理员，请重新登录！');\n
top.location.href='../index.php';\n
</script>";
}else{
if($_SESSION["ad_flag"]=="demo"){
$ad_flag_d=$_SESSION["ad_flag"];
}else{
$ad_flag_d=explode(",",$_SESSION["ad_flag"]);
}
if ($_SESSION["ad_id"]=="" || ($_SESSION['ad_flag']!="demo" && in_array($protectid, $ad_flag_d)==false))
{
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" /><script>
alert('您没有登录或不是管理员，请重新登录！');\n
top.location.href='../index.php';\n
</script>";
}
}
?>